import java.util.Scanner;

/**
 * @author: gao
 * @create-date: 2025/5/31 22:29
 */

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String line = in.nextLine();
        String[] part = line.split(" ");

        char start = part[0].charAt(0);

        int count = 0;

        for (int i = 1; i < part.length; i++) {
            char ch = part[i].charAt(0);
            if (ch == start) {
                count++;
            }
        }

        System.out.println(count);
    }
}